package br.com.obardavez.dao.impl;

import java.util.List;

import javax.persistence.Query;

import br.com.obardavez.base.dao.impl.BaseDAOImpl;
import br.com.obardavez.dao.ParceiroDAO;
import br.com.obardavez.entity.Parceiro;

public class ParceiroDAOImpl extends BaseDAOImpl<Parceiro> implements ParceiroDAO{

	private static final long serialVersionUID = 1L;
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Parceiro> getItensModerados() {
		StringBuilder search = new StringBuilder();
		search.append("select logo ");
		search.append(" from ").append(Parceiro.class.getName());
		search.append(" parceiro ");
		search.append(" where parceiro.moderado = :moderado");
		
		Query query = getEntityManager().createQuery(search.toString());
		query.setParameter("moderado", true);		
		
		return query.getResultList();
	}
}
